//
//  SGEatNumber.h
//  EatNumber
//
//  Created by zg.shao on 14/12/20.
//  Copyright (c) 2014年 kuwo.cn. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "GameAlgorithm.h"

@protocol SGEatNumberDelegate;

@interface SGEatNumber : NSObject

@property (nonatomic, weak) id<SGEatNumberDelegate> delegate;
@property (nonatomic, assign) NSInteger playerWinLevelIndex; // 玩家通过的关

+ (instancetype)defaultEatNumber;

- (void)newGameWithLevel:(NSInteger)level;
- (void)newGameWithNextLevel:(BOOL)nextLevel;

- (void)setFromIndex:(NSInteger)index;
- (NSInteger)fromIndex;

// 返回当前棋盘的状态
- (NSInteger *)gameCells;

// 指定的单元格是否可以向这里移动
- (BOOL)cellCanMoveToIndex:(NSInteger)index;

- (NSString *)tipString;

// 临时合并
- (NSInteger)mergeToIndex:(NSInteger)index;

// 移动单元格
- (void)cellMoveToIndex:(NSInteger)index isMoving:(BOOL)isMoving;

// 保存现场
- (void)saveGameProgress;

// 恢复现场
- (void)restoreGameProgress;

// 重新游戏
- (void)updateGameProgress;

// 获得当前关卡
- (NSInteger)getCurLevel;

// 获得数字的背景颜色
- (UIColor *)getNumberColor:(NSInteger)number;
@end

@protocol SGEatNumberDelegate <NSObject>

@optional
- (void)updateGameProgress:(GameProgress)progress;

@end